<style scoped>
</style>
<!--  -->
<template>
  <div class="operate-repertory-refuse-list dffr">
    <el-button
      type="primary"
      @click="reductionAll"
    >全部还原</el-button>
    <el-button
      type="success"
      @click="clearAll"
    >清空回收站</el-button>
  </div>
</template>

<script>
export default {
  props: {
    resetData: {
      type: Function
    },
    total: {
    }
  },
  data () {
    return {
    }
  },
  methods: {
    // 全部还原
    reductionAll () {
      if (parseInt(this.total) < 1) {
        this.$message({
          showClose: true,
          message: '没有可还原的资源',
          type: 'warning'
        })
        return
      }
      this.$post('/repertory/reduction-all', null).then(() => {
        this.resetData()
      })
    },
    clearAll () {
      if (parseInt(this.total) < 1) {
        this.$message({
          showClose: true,
          message: '没有可清空的资源',
          type: 'warning'
        })
        return
      }
      this.$confirm('清空回收站后，所有回收站内的资源文件均无法恢复！确认清空回收站？', '提示', {
        confirmButtonText: '确定',
        type: 'warning'
      }).then(() => {
        this.$post('/repertory/clear-all', null).then(() => {
          this.resetData()
        })
      }).catch(() => {
      })
    }
  }
}

</script>
